package org.wk.concurrent.app1;

import java.util.concurrent.ConcurrentLinkedQueue;

public class FetchedList {
	private ConcurrentLinkedQueue<String> fetchedList = null;
	
	public FetchedList() {
		fetchedList = new ConcurrentLinkedQueue<String>();
	}
	
	/**
	 * 将一个已经抓取过得队列放置已抓取队列中
	 * @param url
	 */
	public void addUrl(String url) {
		fetchedList.add(url);
	}
	
	/**
	 * 清空该队列
	 */
	public void clear() {
		fetchedList.clear();
	}
	
	/**
	 * 检查这个url是否存在于已抓取队列中
	 * 	如果已经存在，则放弃抓取
	 * @param url
	 * @return
	 */
	public boolean validate(String url) {
		return !fetchedList.contains(url);
	}
	
}
